package se.webbzon.boltzmann.editor.component;

import javax.swing.JPanel;

public abstract class AbstractComponent extends JPanel {
	
	// Auto generated serial version UID
	private static final long serialVersionUID = -5752569496612163696L;
	
	// The name of the component
	private final String name;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates an abstract component with no name. **/
	public AbstractComponent() {
		this(null);
	}
	
	/** Creates an abstract component with a name. **/
	public AbstractComponent(String name) {
		this.name = name;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns true if the component has a name. **/
	public boolean hasName() {
		return !name.isEmpty();
	}
	
	/** Returns the name of the component. If the component does not 
	 * have a name then null is returned. **/
	public String getName() {
		return name;
	}

}
